const mongoClient = require('./models/mongo/client');
const license = require('./models/license');
const logger = require('./models/logger');

/**
 * 硬件狗服务类
 */

class Server {
  constructor() {
    mongoClient.connect().then(() => {}).catch(() => {});

    setInterval(() => license.checkLicenseStatus().catch((err) => {
      logger.error('license query error:', err);
    }), 60000);
  }
}

/**
 * 创建子进程
 */
function createServer() {
  return new Server();
}
/**
 * Export model definition object.
 */
module.exports = createServer;
